<?php

class Application_Model_Db_Db
{
    protected $_db;
    
    private $_dbParams = array(
        'host'           => 'localhost',
        'username'       => 'root',
        'password'       => '',
        'dbname'         => 'electrofa_elsite'
    );

    public function __construct() {
        try {
            $registry = Zend_Registry::getInstance();           
            if (!(isset($registry['db']))) {                
                $this->_db = Zend_Db::factory('Pdo_Mysql', $this->_dbParams);
                $this->_db->getConnection()->exec("set names utf8");
                Zend_Registry::set('db', $this->_db);          
            } else {
                $this->_db = $registry['db'];               
            }            
        } catch (Zend_Db_Adapter_Exception $e) {
            echo $e->getMessage();
        }
    }
}